package com.qiaofang.applet.constants;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * @Author: youqing.yang
 * @Create: 2020/11/10 11:50
 * @Description:
 **/
@Getter
@AllArgsConstructor
public enum CountSynConstants {

    SALE_AND_RENT("租售房源", "Property", "miniProgramSynchronous/synchronousPropertyV3", "property_property")
    ,DEPT("部门","Department","miniProgramSynchronous/synchronousDepartment", "member_department")
    ,EMP("员工","Employee","miniProgramSynchronous/synchronousUser", "member_employee")
    ,DISTRICT("区域","District","miniProgramSynchronous/synchronousDistrict", "property_district")
    ,AREA("商圈","Area","miniProgramSynchronous/synchronousArea", "property_area")
    ,ESTATE("楼盘","Estate","miniProgramSynchronous/synchronousEstate", "property_estate")
    ,ESTATE_PHOTO("楼盘图片","EstatePhoto","miniProgramSynchronous/synchronousEstatePhoto", "property_estate_photo")
    ,SIGN("电子合同","SignContact","miniProgramSynchronous/synchronousSign", "other_sign_contact")
    ,PRO_VR("房源VR","PropertyVr","propertyVr/getAllPropertyVrListFytbNew", "property_property_vr")
    ,PRO_VIDEO("房源视频","PropertyVideo","propertyVideo/getAllPropertyVideoListFytbNew", "property_property_video")
    ,FIRST_PRO("新房","FirsthandEstate","miniProgramSynchronous/synchronousFirsthandEstate", "property_firsthand_estate")
    ,PRO_CONTACT("房源业主","PropertyContact","miniProgramSynchronous/synchronousContact", "property_property_contact")
    ;

    private String type;

    private String value;

    private String method;

    private String collectionName;

    public static String getCollectionNameByType(String type){
        for (CountSynConstants item : values()) {
            if (item.getType() == type) {
                return item.getCollectionName();
            }
        }
        return null;
    }

    public static String getTypeByMethod(String domain){
        for (CountSynConstants item : values()) {
            if (domain.contains(item.getMethod())){
                return item.getType();
            }
        }
        return null;
    }



}
